import java.io.*;
import java.net.MalformedURLException;

public class Web {

	/**Author: svtpahal
	 * @Program reads url from a file and returns corresponding http status code,response message,content length & content type.
	 * Date: Feb 08,2009
	 * */ 
	public static void main(String[] args) {
		
		int responsecode=0;
		String responsemessage="";
		int length=0;
		String type="";
		String url="";
	    
			try {
				/*FileInputStream fstream = new FileInputStream("c:\\url.txt");
			    
			    DataInputStream in = new DataInputStream(fstream);
			    BufferedReader br = new BufferedReader(new InputStreamReader(in));
			    String strLine;
			    
			    while ((strLine = br.readLine()) != null)   {
			      */
			      url="http://anomsoft.com";
			      System.out.println("u:"+url);
			      Webcontent wc=new Webcontent(url);
				  responsecode=wc.getResponseCode();
			      responsemessage=wc.getResponseMessage();
				  length=wc.getLength();
				  type=wc.getType();
				  System.out.println("Http status code: " +responsecode);
				  System.out.println("Response message: "+responsemessage);
				  System.out.println("Content length: " +length);
				  System.out.println("Content type: "+type);
					
			} 
			catch (MalformedURLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			DomTree dt=new DomTree();
			System.out.println(dt.getElement());
				
	}

}
